<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
//  这个文件是 JCAT PHP框架的一部，该项目和此文件 均遵循 GNU 自由软件协议
// 
//  Copyleft 2008 JeCat.cn(http://team.JeCat.cn)
//
//
//  JCAT PHP框架 的正式全名是：Jellicle Cat PHP Framework。
//  “Jellicle Cat”出自 Andrew Lloyd Webber的音乐剧《猫》（《Prologue:Jellicle Songs for Jellicle Cats》）。
//  JCAT 是一个开源项目，它像音乐剧中的猫一样自由，你可以毫无顾忌地使用JCAT PHP框架。
//  JCAT 由中国团队开发维护，是一个国际性的项目。
//  正在使用的这个版本是：0.3.1 / SVN信息：$Id: class.JCAT_DBSQLSelect.php 1119 2008-10-25 03:55:26Z alee $
//
//
//
//  相关的链接：
//    [主页] http://jcat.JeCat.cn
//    [HTTP下载] http://jcat.JeCat.cn/download
//    [在线文档] http://jcat.JeCat.cn/document
//    [社区] http://jj.jecat.cn/forum-7-1.html
//  不很相关：
//    [MP3] http://www.google.cn/search?q=jellicle+songs+for+jellicle+cats+Andrew+Lloyd+Webber
//    [VCD/DVD] http://www.google.cn/search?q=CAT+Andrew+Lloyd+Webber+video
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
/*-- Project Introduce --*/



/**
 * SQL Select 子句
 *
 * @author		alee
 * @access		public
 */
class JCAT_DBSQLSelect extends JCAT_DBSQLRecordsOperate
{

	
	/**
	 * 数据表
	 * 
	 * @access	public
	 * @param	$aFactory		JCAT_DBAbstractFactory				对象工厂
	 * @param	$Tables			JCAT_DBGenericTypes::$TableList		数据表
	 * @return	
	 */
	public function JCAT_DBSQLSelect( JCAT_DBAbstractFactory $aFactory, $Tables=array() ) 
	{
		// 父类 构造函数
		$this->JCAT_DBSQLRecordsOperate($aFactory, $Tables) ;
		
		
		$this->aSubSQLGroup = $aFactory->CreateSubSQLGroup() ;
		$this->aSubSQLOn = $aFactory->CreateSubSQLOn() ;
		$this->aSubSQLReturnColumnList = $aFactory->CreateSubSQLReturnColumnList() ;
		
		
		// 透明围栏 内的对象
		$this->arrObjectsInTransparent[] =& $this->aSubSQLGroup ;
		$this->arrObjectsInTransparent[] =& $this->aSubSQLReturnColumnList ;
		
		
		// 可设置 的对象
		$this->arrSetPropertys['SetSubSQLGroup'] =& $this->aSubSQLGroup ;
		$this->arrSetPropertys['SetSubSQLOn'] =& $this->aSubSQLOn ;
		$this->arrSetPropertys['SetSubSQLReturnColumnList'] =& $this->aSubSQLReturnColumnList ;
		
		$this->arrSetPropertys['SetStringSubSQLGroup'] =& $this->aSubSQLGroup ;
		$this->arrSetPropertys['SetStringSubSQLOn'] =& $this->aSubSQLOn ;
		$this->arrSetPropertys['SetStringSubSQLReturnColumnList'] =& $this->sSubSQLReturnColumnList ;
		
		// 可获取
		$this->arrGetPropertys['GetSubSQLGroup'] =& $this->aSubSQLGroup ;
		$this->arrGetPropertys['GetSubSQLOn'] =& $this->aSubSQLOn ;
		$this->arrGetPropertys['GetSubSQLReturnColumnList'] =& $this->aSubSQLReturnColumnList ;
		
		$this->arrGetPropertys['GetStringSubSQLGroup'] =& $this->sSubSQLGroup ;
		$this->arrGetPropertys['GetStringSubSQLOn'] =& $this->sSubSQLOn ;
		$this->arrGetPropertys['GetStringSubSQLReturnColumnList'] =& $this->sSubSQLReturnColumnList ;
	}

	/**
	 * 创建并返回SQL语句
	 * 
	 * @access	public
	 * @return	string
	 */
	public function MakeSQL()
	{
		// SQL 子句
		$sSubSQLFrom = $this->MakeSubSQL('From') ;
		$sSubSQLWhere = $this->MakeSubSQL('Where') ;
		$sSubSQLOrder = $this->MakeSubSQL('Order') ;
		$sSubSQLLimit = $this->MakeSubSQL('Limit') ;
		$sSubSQLReturnColumnList = $this->MakeSubSQL('ReturnColumnList') ;
		$sSubSQLGroup = $this->MakeSubSQL('Group') ;
		$sSubSQLOn = $this->MakeSubSQL('On') ;
		
		return "SELECT {$sSubSQLReturnColumnList} FROM {$sSubSQLFrom} {$sSubSQLWhere} {$sSubSQLGroup} {$sSubSQLOn} {$sSubSQLOrder} {$sSubSQLLimit} ;" ;
	}



	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @param	$SubSQLGroup		What's this Parameter ?
	 * @return	
	 */
	// public function SetSubSQLGroup(  $SubSQLGroup )



	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @return	
	 */
	// public function GetSubSQLGroup()


	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @param	$SubSQLReturnColumnList		What's this Parameter ?
	 * @return	
	 */
	// public function SetSubSQLReturnColumnList(  $SubSQLReturnColumnList )



	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @return	
	 */
	// public function GetSubSQLReturnColumnList() 



	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @param	$SubSQLOn		What's this Parameter ?
	 * @return	
	 */
	// public function SetSubSQLOn(  $SubSQLOn ) 



	/**
	 * What's this Method ?
	 * 
	 * @access	public
	 * @return	
	 */
	// public function GetSubSQLOn()


	// 属性 ///////////////////////////////////////////////////////////////////////////////

	/**
	 * SubSQL Group 子句
	 * 
	 * @access	private
	 * @var		JCAT_DBSubSQLGroup
	 */
	private $aSubSQLGroup = null ;
	
	/**
	 * SubSQL Group 子句
	 * 
	 * @access	private
	 * @var		string
	 */
	private $sSubSQLGroup = null ;

	/**
	 * SubSQL ReturnColumnList 子句
	 * 
	 * @access	private
	 * @var		JCAT_DBSubSQLReturnColumnList
	 */
	private $aSubSQLReturnColumnList = null ;

	/**
	 * SubSQL ReturnColumnList 子句
	 * 
	 * @access	private
	 * @var		string
	 */
	private $sSubSQLReturnColumnList = null ;

	/**
	 * SubSQL On 子句
	 * 
	 * @access	private
	 * @var		JCAT_DBSubSQLOn
	 */
	private $aSubSQLOn = null ;

	/**
	 * SubSQL On 子句
	 * 
	 * @access	private
	 * @var		string
	 */
	private $sSubSQLOn = null ;


}
?>